﻿using System.Collections;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Devonline.Http
{
    /// <summary>
    /// 适用于显式的分页参数查询的返回值
    /// </summary>
    public class PagedResult
    {
        public PagedResult()
        {
            PageIndex = 1;
            PageSize = 10;
        }

        /// <summary>
        /// 查询结果总数目
        /// </summary>
        [JsonPropertyName("total")]
        public int Total { get; set; }
        /// <summary>
        /// 当前页码
        /// </summary>
        [JsonPropertyName("pageIndex")]
        public int PageIndex { get; set; }
        /// <summary>
        /// 页大小
        /// </summary>
        [JsonPropertyName("pageSize")]
        public int PageSize { get; set; }
        /// <summary>
        /// 当前页数据集合
        /// </summary>
        [JsonPropertyName("rows")]
        public IEnumerable Rows { get; set; }
    }

    /// <summary>
    /// 适用于显式的分页参数查询的返回值
    /// </summary>
    public class PagedResult<T>
    {
        public PagedResult()
        {
            PageIndex = 1;
            PageSize = 10;
        }

        /// <summary>
        /// 查询结果总数目
        /// </summary>
        [JsonPropertyName("total")]
        public int Total { get; set; }
        /// <summary>
        /// 当前页码
        /// </summary>
        [JsonPropertyName("pageIndex")]
        public int PageIndex { get; set; }
        /// <summary>
        /// 页大小
        /// </summary>
        [JsonPropertyName("pageSize")]
        public int PageSize { get; set; }
        /// <summary>
        /// 当前页数据集合
        /// </summary>
        [JsonPropertyName("rows")]
        public IEnumerable<T> Rows { get; set; }
    }
}
